﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace PhotoDecoratorInterface
{
    interface IPhoto
    {
        void Draw(object sender, PaintEventArgs e);
    }
    class Photo:Form,IPhoto
    {
        Image image;
        
        public Photo()
        {
            image = new Bitmap("jug.jpg");
            this.Text = "Lemonade";
            this.Paint += new PaintEventHandler(Draw);
        }


        public void Draw(object sender, PaintEventArgs e)
        {
            e.Graphics.DrawImage(image, 30, 20);
        }
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // Photo
            // 
            this.ClientSize = new System.Drawing.Size(283, 250);
            this.Name = "Photo";
            this.ResumeLayout(false);

        }

 
    }
    class DecoratorBorder:Form,IPhoto
    {
        IPhoto m;
        Color color;
        public DecoratorBorder(IPhoto s,Color c)
        {
            m = s;
            color = c;
            this.Paint += new PaintEventHandler(Draw);
        }

        public void Draw(object sender, PaintEventArgs e)
        {
            m.Draw(sender, e);
            e.Graphics.DrawRectangle(new Pen(color, 10), 25, 15, 215, 225); 
        }

        
    }
    class Client
    {
      
        static void Main()
        {
            Console.WriteLine("Decorator Pattern\n");
            IPhoto s = new Photo();
        
            DecoratorBorder m = new DecoratorBorder(s, Color.Blue);
            Application.Run(m);


        }
    }
}
